//
//  NewsTableViewCell.m
//  BigToBig
//
//  Created by 毛丽媛 on 16/7/18.
//  Copyright © 2016年 cn.cloudtp. All rights reserved.
//

#import "NewsTableViewCell.h"
#define WIDTH self.contentView.frame.size.width
#define height self.contentView.frame.size.height

@implementation NewsTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}
- (void)createView{
    
    self.headPic = [[UIImageView alloc] init];
    //self.headPic.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.headPic];
    
    self.name = [[UILabel alloc] init];
    //self.name.backgroundColor = [UIColor cyanColor];
    self.name.font = [UIFont systemFontOfSize:19];
    [self.contentView addSubview:self.name];
    
    self.content = [[UILabel alloc] init];
    //self.content.backgroundColor = [UIColor magentaColor];
    self.content.font = [UIFont systemFontOfSize:14];
    self.content.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.content];
    
    self.right = [[UIButton alloc] init];
    //self.right.backgroundColor =[UIColor yellowColor];
    [self.right setTitleColor:[UIColor colorWithRed:0.143 green:0.575 blue:1.000 alpha:1.000] forState:UIControlStateNormal];
    self.right.layer.cornerRadius = 2;
    self.right.layer.borderWidth = 1;
    
    //self.right.layer.borderColor=[UIColor colorWithWhite:0.856 alpha:1.000].CGColor;
    //[self.contentView addSubview:self.right];
    
    self.timeLabel = [[UILabel alloc] init];
    self.timeLabel.textColor = [UIColor lightGrayColor];
    self.timeLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.timeLabel];
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.headPic.frame = CGRectMake(15, 15, height - 30, height - 30);
    self.name.frame = CGRectMake(self.headPic.maxX + 10, self.headPic.y,180, 30);
    self.content.frame = CGRectMake(self.headPic.maxX + 10, self.name.maxY, WIDTH - 100, 20);
    self.right.frame = CGRectMake(WIDTH - 60, 20, 50, 30);
    self.timeLabel.frame = CGRectMake(WIDTH - 60, 20, 50, 30);
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
